﻿@{
    ViewBag.Title = "Index";
}

@this.RefStyle("~/Content/wdtree/tree.css")
@this.RefScript("~/Content/wdtree/tree.js")
@this.Partial("Index_js")

<div style="max-width:1000px;">
    <div class="topPanel">
        <div class="toolbar">
            <a class="a-btn-refresh" onclick="$ace.reload()"></a>
            <button class="a-btn-edit" data-bind="click:edit,disable:!dataTable.selectedModel()">修改</button>
            <button class="a-btn-add" data-bind="click:add">添加</button>
            <button class="a-btn-delete" data-bind="click:del,disable:!dataTable.selectedModel()">删除</button>
            <button class="a-btn-primary fa fa-eye" data-bind="click:assignPermission,attr:{disabled:!dataTable.selectedModel()}">权限设置</button>
        </div>
        <div class="search">
            <table class="form-table" style="width:400px;">
                <tr>
                    <td>
                        <input type="text" class="a-control" placeholder="请输入要查询关键字" style="width: 200px;" data-bind="value:searchModel().keyword">
                    </td>
                    <td>
                        <button type="button" class="a-btn-search" data-bind="click:search"></button>
                    </td>
                </tr>
            </table>
        </div>
    </div>


    <div>
        <table class="table table-hover" data-bind="with:dataTable">
            <thead>
                <tr>
                    <th style="width:20px;"></th>
                    <th>编号</th>
                    <th>角色名称</th>
                    <th>状态</th>
                </tr>
            </thead>
            <tbody data-bind="foreach:models">
                <tr data-bind="click:$parent.selectRow">
                    <td data-bind="text:$parent.getOrdinal($index())"></td>
                    <td data-bind="text:ID"></td>
                    <td data-bind="text:RoleName"></td>
                    <td><span data-bind="text:ST()?'启用':'禁用',attr:{class:ST()?'a-span-success-s':'a-span-danger-s'}"></span></td>
                </tr>
            </tbody>
        </table>
    </div>
</div>
<dialogbox data-bind="with:dialog">
    <form id="form1">
        <table class="form-table">
            <tr>
                <td class="form-title">名称</td>
                <td class="form-value">
                    <input name="RoleName" type="text" class="a-control required" placeholder="请输入名称" data-bind="value:model().RoleName" />
                    <input name="ID" type="hidden" class="a-control required"  data-bind="value:model().ID" />
                </td>
            </tr>
            <tr>
                <td class="form-title">是否启用</td>
                <td class="form-value">
                    <input id="ST1" class="a-radio" name="Type" type="radio" value="1" data-bind="typedChecked:model().ST,dataType:'int'"><label for="ST1">是</label>
                    <input id="ST0" class="a-radio" name="Type" type="radio" value="0" data-bind="typedChecked:model().ST,dataType:'int'"><label for="ST0">否</label>
                </td>
            </tr>
           
        </table>
    </form>
</dialogbox>

<dialogbox data-bind="with:permissionDialog">
    <form id="form-permission">
        <div id="permissionTree"></div>
    </form>
</dialogbox>
